﻿@model IEnumerable<Cafeteria.Models.Administracion.Usuario.UsuarioxSucursalBean>

@{
    ViewBag.Title = "AdministrarPerfil";
}

<h2>AdministrarPerfil</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("../../Scripts/ventanamodal.js")" type="text/javascript"></script>

@using (Html.BeginForm("AdministrarPerfil", "Usuario", FormMethod.Post, new { @class = "form" }))
{
    @Html.ValidationSummary(false)
    <fieldset>
        <div class = "widget" >
            <div class = "title"><h6>Administrar Perfil</h6></div>

            <div class="formRow">
                <label>Nombre</label>
                <div class = "formRight" ><input type = "text" id = "nombre" name = "nombre" /></div>
                <div class = "clear" ></div>
            </div>
            <div class="formRow">
                <label>DNI</label>
                <div class = "formRight" ><input type = "text" id = "dni" name = "dni" /></div>
                <div class = "clear" ></div>
            </div>

            <div class="formRow">
               <label>Perfil</label>                           
                
                <div class = "formRight" >
                <div class = "selector" >@Html.DropDownListFor(model => model.ElementAt(0).idPerfil, Model.ElementAt(0).usuarioList)</div></div>
                <div class = "clear" ></div>
            </div>


        </div>
    </fieldset>
    <p>
        <input type="submit" value="Buscar" class = "redB" /> |   <a href="javascript:history.back()">Regresar</a>  
    </p>
}

<p></p><p></p>

@if (ViewBag.estado != 0)
{    
    <div class="wrapper">
        <div class="widget">
          <div class="title"><h6>Lista de Personal</h6></div>
          <div class="dataTables_wrapper">
          
              <table cellpadding = "0" cellspacing = "0" width = "100%" class = "display dTable"> 
                <thead>
                <tr>
                    <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                        <div class="DataTables_sort_wrapper">
                        Nombre
                        <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                        </div>
                     </th>
                    <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                        <div class="DataTables_sort_wrapper">
                        DNI
                        <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                        </div>
                     </th>
                     <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                        <div class="DataTables_sort_wrapper">
                        FechaIngreso
                        <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                        </div>
                     </th>
                     <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                        <div class="DataTables_sort_wrapper">
                       Perfil
                        <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                        </div>
                     </th>
                    <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >

                    </th>
                </tr>
            </thead>
                <tbody>
                      @foreach (var item in Model)
                      {
                            <tr class="gradeA odd">
                                <td class=" sorting_1">@Html.DisplayFor(modelItem => item.nombres) @Html.DisplayFor(modelItem => item.apPat)</td>
                                <td class=" sorting_1">@Html.DisplayFor(modelItem => item.nroDocumento) </td>
                                <td class=" sorting_1">@Html.DisplayFor(modelItem => item.fechaIngreso)</td>
                                <td class=" sorting_1">
                                    @for (int i = 0; i < item.perfilesDelUsuario.Count; i++)
                                    {
                                            @Html.DisplayFor(modelItem => item.perfilesDelUsuario[i]) 
                                    }
                                </td>
                                <td class=" sorting_1">
                                   @* <a href="@Url.Action("Asignarperfil", new { id = item.ID })">Asignar Perfil </a>  *@
                                    <img src="../../Content/images/icons/color/pencil.png", alt="Edit" />
                                    @Html.ActionLink("Asignar Perfil", "modal/" + item.ID, null, new { @class = "modal" }) 
                                </td>
                            </tr>
        
                      }

            </tbody>
              
              </table>                                                                                                                                                                                               
                           
               
          </div>
        
        </div>
    </div>
    
    
}



